<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<% response.setContentType("text/html; charset=UTF-8");%>
<% request.setCharacterEncoding("utf-8");%>

<%
    String type = null;
    int maTS = 0, id = 0;
    String hoten = null, username = null;
    HttpSession ss = request.getSession();
    if (ss.getAttribute("isLogin") == null) {
        response.sendRedirect("login.jsp");
    } else if (ss.getAttribute("isLogin").equals(false)) {
        response.sendRedirect("login.jsp");
    } else {
        type = ss.getAttribute("type").toString();
        if (type.equals("TS")) {
            maTS = Integer.parseInt(ss.getAttribute("maTS").toString());
            hoten = ss.getAttribute("hoten").toString();
        } else {
            id = Integer.parseInt(ss.getAttribute("id").toString());
            username = ss.getAttribute("username").toString();
        }
    }
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Thi trắc nghiệm online</title>
        <link rel="stylesheet" href="css/style.css" type="text/css" />
        <script type="text/javascript" src="js/general_functions.js"></script>
        <link rel="stylesheet" href="css/cauhoi.css" type="text/css" />
        <script type="text/javascript" src="js/cauhoi.js"></script>
        <script type="text/javascript" src="js/jquery-1.7.2.js"></script>
    </head>
    <body>

        <!-- BEGIN Header -->
        <div id="header">
            <div id="header-content">
                <h2 id="slogan">Thi trắc nghiệm online</h2>
                <ul id="header-links">
                    <li>
                        <%
                            if (type.equals("TS")) {
                                out.print(hoten);
                            } else {
                                out.print(username);
                            }
                        %>
                    </li>
                    <li><a href="logout.jsp">Đăng xuất</a></li>
                </ul>
                <!-- Menu Tabs -->
                <ul>
                    <li><a href="index.jsp" title="Trang chủ"><span>Trang chủ</span></a></li>
                    <li><a href="thi.jsp" title="Thi trắc nghiệm"><span>Thi trắc nghiệm</span></a></li>
                    <li><a href="thongke.jsp" title="Tổng hợp kết quả thi"><span>Tổng hợp kết quả thi</span></a></li>
                    <li id="current"><a href="cauhoi.jsp" title="Soạn câu hỏi"><span>Soạn câu hỏi</span></a></li>
                </ul>
            </div>
        </div>
        <!-- END Header -->
        <!-- BEGIN Content -->
        <div id="content">

            <%
                if (type.equals("TS")) {
                    out.println("<h1>Bạn không phải người quản trị</h1>");
                    return;
                }
            %>

            <div class="title">
                <div id="title">IMPORT CÂU HỎI TỪ FILE XML</div>
                <div id="hint">Chọn file câu hỏi và nhấn Import</div>
            </div>
            <div id="import_ketqua"></div>
            <form id="import" action="cauhoi_import" method="POST" enctype="multipart/form-data" onsubmit="return cauhoi_import();">
                <input type="file" id="import_file" name="import_file" style="border:solid 1px #000;">
                <input type="submit" id="button" value="Import">
            </form>

            <br/><hr size="2" style="background-color:#3333ff"/><br/><br/>

            <div class="title">
                <div id="title">EXPORT CÂU HỎI RA FILE XML</div>
                <div id="hint">Chọn Export và download link bên dưới.</div>
            </div>
            <br/>
            <div id="export_ketqua"><input type="button" id="button" value="Export" onclick="cauhoi_export();"></div>
            <br/>
            <br/>
        </div>
        <!-- END Content -->

        <!-- BEGIN footer -->
        <div id="footer">
            <div id="footer-content">
                <div class="footer-left">
                    <p style="text-align: right">
                        &copy; copyright 2006-2011 <strong class="separator">www.styleshout.com</strong>
                    </p>
                </div>
            </div>
        </div>
        <!-- END footer -->
    </body>
</html>
